package jlib.component.scroll.skin
{
	import jlib.component.core.Form;
	
	import flash.display.DisplayObject;
	import flash.display.GradientType;
	import flash.display.InteractiveObject;
	import flash.display.Shape;
	import flash.geom.Matrix;
	
	public class ScrollBarSkinFactory
	{
		static public const DEFAULT_LONG_STRICT:Number = 76;
		static public const DEFAULT_SHORT_STRICT:Number = 22;
		
		public function ScrollBarSkinFactory()
		{
			throw new Error('static 전용입니다.');
		}
		
		static public function getHorizontalPrevButton(): InteractiveObject
		{
			var skin:Button = new Button();
			var shape:Shape = new Shape();
			shape.graphics.beginFill(0x969696, 1);
			Drawer.triangle(shape.graphics, 0, 0, 4);
			shape.rotation = 180;
			skin.setCenterShape(shape);
			skin.width = 20;
			skin.height = 20;
			return skin;
		}
		
		static public function getHorizontalNextButton(): InteractiveObject
		{
			var skin:Button = new Button();
			var shape:Shape = new Shape();
			shape.graphics.beginFill(0x969696, 1);
			Drawer.triangle(shape.graphics, 0, 0, 4);
			skin.setCenterShape(shape);
			skin.width = 20;
			skin.height = 20;
			return skin;
		}
		
		static public function getVerticalPrevButton(): InteractiveObject
		{
			var skin:Button = new Button();
			var shape:Shape = new Shape();
			shape.graphics.beginFill(0x969696, 1);
			Drawer.triangle(shape.graphics, 0, 0, 4);
			shape.rotation = 270;
			skin.setCenterShape(shape);
			skin.width = 20;
			skin.height = 20;
			return skin;
		}
		
		static public function getVerticalNextBtton(): InteractiveObject
		{
			var skin:Button = new Button();
			var shape:Shape = new Shape();
			shape.graphics.beginFill(0x969696, 1);
			Drawer.triangle(shape.graphics, 0, 0, 4);
			skin.setCenterShape(shape);
			shape.rotation = 90;
			skin.width = 20;
			skin.height = 20;
			return skin;
		}
		
		static public function getHorizontalTrack(): DisplayObject
		{
			var shape:Shape = new Shape;
			var matrix:Matrix = new Matrix;
			matrix.createGradientBox(ScrollBarSkinFactory.DEFAULT_LONG_STRICT,ScrollBarSkinFactory.DEFAULT_SHORT_STRICT,-5,0);
			shape.graphics.beginGradientFill(GradientType.LINEAR, [0xcccccc,0xffffff], [0.1,1], [0,255], matrix);
			shape.graphics.drawRect(0,0,ScrollBarSkinFactory.DEFAULT_LONG_STRICT,ScrollBarSkinFactory.DEFAULT_SHORT_STRICT);
			var form:Form = new Form();
			form.setBorder(1,0xcccccc,'solid');
			form.setBackground(shape);
			return form;
		}
		
		static public function getHorizontalThumb(): InteractiveObject
		{
			var skin:Button = new Button;
			var shape:Shape = new Shape();
			
			Drawer.centerHLines(shape.graphics);
			skin.setCenterShape(shape);
			skin.height = 20;
			return skin;
		}
		
		static public function getVerticalTrack(): DisplayObject 
		{
			var shape:Shape = new Shape;
			var matrix:Matrix = new Matrix;
			matrix.createGradientBox(ScrollBarSkinFactory.DEFAULT_SHORT_STRICT,ScrollBarSkinFactory.DEFAULT_LONG_STRICT,0,-5);
			shape.graphics.beginGradientFill(GradientType.LINEAR, [0xcccccc,0xffffff], [0.1,1], [0,255], matrix);
			shape.graphics.drawRect(0,0,ScrollBarSkinFactory.DEFAULT_SHORT_STRICT,ScrollBarSkinFactory.DEFAULT_LONG_STRICT);
			var form:Form = new Form();
			form.setBorder(1,0xcccccc,'solid');
			form.setBackground(shape);
			return form;
		}
		
		static public function getVerticalThumb(): InteractiveObject
		{
			var skin:Button = new Button;
			var shape:Shape = new Shape();
			Drawer.centerVLines(shape.graphics);
			skin.setCenterShape(shape);
			skin.width = 20;
			return skin;
		}
	}//c
}